package it.pir.es01ProduttoreConsumatore;

import java.io.IOException;
import java.io.ObjectOutputStream;

public class ServerConsumatore implements Runnable {

	private ServerBuffer<Pacchetto> sb;
	private ObjectOutputStream out;
	
	public ServerConsumatore(ObjectOutputStream out,ServerBuffer<Pacchetto> serverBuffer){
		this.sb = serverBuffer;
		this.out = out;
	}
	
	public void run() {
		Pacchetto p1 = sb.take();
		try {
			out.writeObject(p1);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}
